# -*- coding: utf-8 -*-
# @file: logger.py
# @author: ZhuJiahui1991
# @time: 2018/2/1 22:46
# @version: v1.0

import sys
import logging

logger = logging.getLogger('zhupy')

# 指定logger输出格式
formatter = logging.Formatter('%(asctime)s %(levelname)-8s: %(message)s')

# 文件日志
file_handler = logging.FileHandler("zhupy.log")
file_handler.setFormatter(formatter)

# 控制台日志
console_handler = logging.StreamHandler(sys.stdout)
console_handler.formatter = formatter

# 为logger添加的日志处理器
logger.addHandler(file_handler)
logger.addHandler(console_handler)

# 指定日志的最低输出级别，默认为WARN级别
logger.setLevel(logging.INFO)


if __name__ == "__main__":
    pass